home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
cuj0696.zip
/
DWYER.ZIP
/
COUPON.TST
/
README.CPN
< prev
next >
Wrap
Text File
|
1996-01-05
|
4KB
|
109 lines
DESCRIPTION OF THE COUPON COLLECTOR'S TEST
Introduction
------------
This is a strange name for a test of random number generators. It is
a time-honored name, though, having been introduced by R.E. Greenwood
in 1955 [G1]. A coupon is a set of numbers from zero
to the upper limit of the number space. For example, if integers
modulo 16 comprise the number space, a coupon is the set of integers
from 0 to 15. The coupon collector's test counts the random numbers
that must be generated to yield a coupon. Mixed in with the set of
coupon members will be repetitions. The idea is to count everything
until a "complete set" is found. The count of random numbers generated
is called the "length" of the segment that contains the coupon.
Since the length of a complete set must be at least the size of the
coupon, the coupon collector's test tallies lengths that range from
the length of the coupon to some maximum that you choose. The
algorithm for collecting data for the coupon collector's test is
given on pages 62-63 of Knuth [K1]. The probabilities associated
with the segment lengths are calculates as follows:
Let d be the size of the number space and t be the maximum
segment length to be tallied. That is, a coupon will consist
of numbers between 0 and d-1 and the maximum segment length
will be larger than d. The number of categories in the test
is k = t - d + 1. The probabilities are (from [K1, p. 63]):
d! {r - 1} d! {t - 1} | [x] subscript x
p[r] = -- { }, d <= r < t; p[t] = -----{ } | ^x exponent x
d^r {d - 1} d^t-1{ d } | the {} should
| be typed as a
where {} denotes a Stirling number of the second kind. | Stirling number
see Knuth, p 63
A Stirling number of the second kind, {k,r}, is the number of ways
of partitioning k elements into r non-empty subsets ([H1], page 824).
The coupon test is implemented as program cupontst. This program
performs a Kolmogorov-Smirnov analysis on probabilities from 100
chi-square tests. The parameters that determine how the chi-square
tests are performed are specified by you. These parameters
are read from the console unless you redirect the input device.
As usual, prompts and messages are written to stderr and results
are written to stdout.
Running the Coupon Test
----------------------
To start program cupontst, you can say simply
cupontst
and you will be prompted for the required inputs.
Alternatively, you can say
cupontst < [myfile.inp]
and the program will take its input data from myfile.inp.
Six input parameters are required:
1. Seed for the random number generator (-1 = Time of day)
If you do not specify -1, the value entered must be less
than 65536.
2. Specification of generator to be tested
If you are working interactively, you will see a list
of the generators that can be selected. You enter the
character that represents your generator. If you enter
a character that is not in the list, the library rand()
function will be used.
3. Number of unique integers in a coupon (d)
This is the size of a coupon. A coupon will consist of
numbers from 0 to d-1. The program currently limits your
choice to the range 5-25. These limits are defined in a
header file, cupndefs.h.
4. Maximum segment length (t)
Segments lengths of t or larger will be tallied as segments
of length t. The program currently limits your choice to
the range 11-100. These limits are defined in a header file,
cupndefs.h.
5. Minimum cell expectation
This is the minimum number of tallies that you want per
category ("cell" is a synonym for category). This number
is used to determine the number of variates that should
be generated. The program currently limits your choice
to the range 5-100. The number 5 is specified because
it is the lowest number that is considered statistically
significant.
REFERENCE
G1. Robert E. Greenwood, Coupon Collector's Test for Random Digits,
Math. Tables & Other Aids to Computation, 9 (1955), pp. 1-4.
H1. Handbook of Mathematical Tables, ed. by M. Abramowitz
and I. A. Stegun (Washington, D.C.: U.S. Gov't Printing
Office, 1964).